import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";

import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// import { visualizer } from 'rollup-plugin-visualizer'; //检查打包大小

export default defineConfig({
    // base:'/test/', //如需二级目录，在这里加
    plugins: [
        // visualizer({
        //     open: true,
        //     gzipSize: true,
        //     brotliSize: true
        // }),
        vue(),
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver()],
        }),
    ],
    server:{ port:8800 },
    resolve: {
        alias: {
            "@": path.resolve(__dirname, "./src") // map '@' to './src' 
        },
    },
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: `@import "@/public.scss";`
            }
        }
    },
    build:{
        brotliSize: false, // 消除打包大小超过500kb警告
        outDir: './dist/manager' //在这里定义最终的生成文件，与python文件配合
        // rollupOptions: {
        //     output: {
        //         manualChunks:{
        //             lodash: ['tinymce']
        //         }
        //     }
        // }
        // assetsDir: 'assets/img',
    }
})
